/**
 * 公共方法
 */
var yntdc = {
		/**
		 * 点击漏斗图片事件
		 * @param fn 回调函数
		 */
		clkFunnelImg: function(fn) {
			var obj = $('#funnelImg');
			if (obj) {
				var box = $('#cdtLayer');
				if (box) {
					var d = box.css('display');
					if (d == 'none') {
						// 条件层宽度：window宽度-28（左右各padding14px）
						box.width($(window).width() - 28);
						box.show();
						//box.css('left', obj.offset().left);
						//box.css('top', obj.offset().top + 30);
						box.css('left', 14);// 左侧14px
						box.css('top', 30);// 顶部条件条30px
						if (typeof (fn) === 'function') {
							fn();
						}
					} else {
						box.hide();
					}
				}
			}
		},
		/**
		 * 清除缓存
		 * @param cacheName 缓存名称
		 * @param fn 回调方法
		 */
		clearCache: function(cacheName, fn) {
			var param = Param.getDeleteCmd();
			var cond = {};
			if (cacheName) {
				cond['CACHE_NAME'] = Param.buildParamItem('=', cacheName, Param.SQLType.VARCHAR);
			}
			param = Param.buildParam(param, cond);
			param[Param.CMDTYPEKEY] = 0;// 清除缓存
			Util.post(Global.commonUrl, param, fn);
		},
		/**
		 * 获取品牌、产品对比分析 数据截至日期
		 * @param id 控件id
		 */
		getMaxDate:function(id){
			id = (!Util.undfd(id) && !Util.nvl(id)) ? id : 'max_date';				
			var param = Param.getReadCmd();
			param[Param.CMDTYPEKEY] = 19;
			var cdt = {};
			cdt['TABNAME'] = Param.buildParamItem('=', 'HYDATA.K_DS_TJBS_Y_Q_M_P_D_ALL', Param.SQLType.VARCHAR);
			param = Param.buildParam(param, cdt);
			Util.doPost('/business/commonServlet', param, function(data) {
				if (!Util.undfd(data) && !Util.nvl(data)
						&& !Util.undfd(data.MAXDATE) && !Util.nvl(data.MAXDATE)) {
					Util.setValToHtml(id, '截止日期：'+ data.MAXDATE +'&nbsp;&nbsp;');
				}
			}, null);
		},
		/**
		 * 加载云南中烟下的品牌
		 * @param fn
		 */
		loadYNBrand: function(fn) {
			var param = Param.getReadCmd();
			param = Param.buildParam(param, {});
			var cdt = {};
			// 云南中烟
			cdt['CIG_FACT_POPEDOM_CODE'] = Param.buildParamItem('=', Global.ynInduCode, Param.SQLType.VARCHAR);
			param = Param.buildParam(param, cdt);
			// 卷烟品牌6
			param[Param.CMDTYPEKEY] = 6;
			param[Param.CMDVALUEKEY] = 1;// 带全部
			Util.doPost(Global.commonUrl, param, fn);
		},
		/**
		 * 获取件码供应链关键指标阀值
		 * @param englsName 指标英文名称
		 */
		getJMFlowThrshd: function(englsName, fn) {
			var param = Param.getReadCmd();
			param = Param.buildParam(param, {});
			var cdt = {};
			if (!Util.nvl(englsName) && !Util.undfd(englsName)) {
				cdt['INDEX_ENGLS_NAME'] = Param.buildParamItem('=', englsName, Param.SQLType.VARCHAR);
			}
			param = Param.buildParam(param, cdt);
			// 件码供应链关键指标阀值20
			param[Param.CMDTYPEKEY] = 20;
			Util.doPost(Global.commonUrl, param, fn);
		},
		/**
		 * 获取经营方式
		 * @param fn 回调函数
		 */
		getProductionType: function(fn) {
			var param = Param.getReadCmd();
			param = Param.buildParam(param, {});
			var cdt = {};
			param = Param.buildParam(param, cdt);
			// 经营方式21
			param[Param.CMDTYPEKEY] = 21;
			param[Param.CMDVALUEKEY] = 1;// 带全部
			Util.doPost(Global.commonUrl, param, fn);
		},
		/**
		 * 获取经营方式
		 * @param fn 回调函数
		 * @param all undefined-带全部 else-不带全部
		 */
		getMangMode: function(fn, all) {
			var param = Param.getReadCmd();
			param = Param.buildParam(param, {});
			var cdt = {};
			param = Param.buildParam(param, cdt);
			// 经营方式21
			param[Param.CMDTYPEKEY] = 21;
			if (Util.undfd(all)) {
				param[Param.CMDVALUEKEY] = 1;// 带全部
			}
			Util.doPost(Global.commonUrl, param, fn);
		},
		/**
		 * 获取仓库信息
		 * @param fn 回调函数
		 * @param all undefined-带全部 else-不带全部
		 */
		getWarehouseInfo: function(fn, all) {
			var param = Param.getReadCmd();
			param = Param.buildParam(param, {});
			var cdt = {};
			param = Param.buildParam(param, cdt);
			// 仓库信息24
			param[Param.CMDTYPEKEY] = 24;
			if (Util.undfd(all)) {
				param[Param.CMDVALUEKEY] = 1;// 带全部
			}
			Util.doPost(Global.commonUrl, param, fn);
		},
		
};
